package com.itheima.vmmysql.Service.Impl;

import com.itheima.vmmysql.Mapper.IndexMapper;
import com.itheima.vmmysql.Service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Service
public class IndexServiceImpl implements IndexService {
    @Autowired
    private IndexMapper indexMapper;
    @Override
     public List<String> getTableNames() {
        List<Map<String, Object>> tableNameData = indexMapper.getTableName();

        // 提取 Map 中的值并转换为 List<String>
        return tableNameData.stream()
                .map(entry -> entry.values().iterator().next().toString())
                .collect(Collectors.toList());
    }
}
